//
//  BK_My_Order_SectionModel.m
//  bestkeep
//
//  Created by TOPTEAM on 2017/2/17.
//  Copyright © 2017年 utouu. All rights reserved.
//

#import "BK_My_Order_SectionModel.h"
#import "BKMyOrderCellHeaderView.h"
#import "BKMyOrderCellFootView.h"
#import "BKMyOrderRecommendCell.h"
@implementation BK_My_Order_SectionModel
+(BK_My_Order_SectionModel *)crete_Order_SetionWithModel:(BK_My_Order_rows_Model *)model{
    
    BK_My_Order_SectionModel *section = [BK_My_Order_SectionModel ModelWithCells:model.item_list AndOrderModel:model];
    /*
     * isShow_Return_Goods   设置退换货
     */
    for (BK_My_Order_rows_itemList_Model *detailModel in model.item_list) {
        if ([detailModel.returnFlag isEqualToString:@"0"]) {
            model.isShow_Return_Goods = YES;
        }
    }
    section.model_Order_rows = model;
    
    section.headViewClassName = NSStringFromClass([BKMyOrderCellHeaderView class]);
    section.footViewClassName = NSStringFromClass([BKMyOrderCellFootView class]);
    section.headerhHeight = cellHederHeight;
    section.footerHeight  = cellFootHeight;
    NSString *str = [NSString stringWithFormat:@"%@,%@",model.order_id,model.order_no];
    section.headReuseIdentifier = str;
    section.footReuseIdentifier = str;
    section.minimumLine = 0;
    return section;
    
}


/*
 * 这是一个Section的中间部分     也就是商品组
 */
+(BK_My_Order_SectionModel*)ModelWithCells:(NSArray*)cells AndOrderModel:(BK_My_Order_rows_Model*)model{
    
    NSMutableArray *arry = [NSMutableArray array];
    
    [cells enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        BK_My_Order_rows_itemList_Model * detailmodel = obj;
        /*
         * 手动赋值
         */
        detailmodel.thNormalType = model.thNormalType;
        
        BK_My_Order_CellModel *cell = [BK_My_Order_CellModel Create_Cell_WithModel:detailmodel];
        cell.model_Order_rows = model;
        
        [arry addObject:cell];
    }];
    
    BK_My_Order_SectionModel *section = [[BK_My_Order_SectionModel alloc]init];
    section.OrderCells = arry;
    
    return section;
    
}


//+(BK_My_Order_SectionModel *)CreteOrderEmptySection{
//    
//    BK_My_Order_CellModel *model = [[BK_My_Order_CellModel alloc]init];
//    model.className = NSStringFromClass([BKMyOrderEmptyCell class]);
//    model.reuseIdentifier = @"Empty";
//    model.ItemSize = CGSizeMake(ScreenWidth, ScreenHeight *0.45);
//    BK_My_Order_SectionModel *buyNill = [[BK_My_Order_SectionModel alloc]init];
//    buyNill.headerhHeight = 0;
//    buyNill.footerHeight = 0;
//    buyNill.OrderCells =[NSArray arrayWithObject:model];
//    buyNill.minimumLine = 0;
//    return buyNill;
//    
//}
@end












































